package com.qf.utils;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;

/**
 * @author zjw
 * @description
 * @date 2021/11/3 14:49
 */
public class ElasticsearchUtil {

    private static final String HOST = "192.168.41.41";
    private static final int PORT = 9200;


    public static RestHighLevelClient getClient(){

        HttpHost hosts = new HttpHost(HOST,PORT);

        RestClientBuilder builder = RestClient.builder(hosts);

        RestHighLevelClient client = new RestHighLevelClient(builder);

        return client;
    }
}
